home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / kcl / akcl / akcl1615.lha / c / nmul.c < prev    next >
C/C++ Source or Header  |  1990-08-28  |  658b  |  39 lines

  1.  
  2. #include "arith.h"
  3.  
  4. extended_mul(a,b,c,h,l)
  5. unsigned int a,b,c, *h, *l;
  6. {unsigned int temph,templ,ah,al,i;
  7.  ah=0;
  8.  al=0;
  9.  /* in case the shift by 32 does not zero an unsigned int..
  10.   we separate out the first step.*/
  11.  {if (b & 1)
  12.       {temph=0;templ=a;
  13.        ladd(temph,templ,ah,al);}
  14. /*    printf("\n%d b=%d a=%d (%d:%d)",i,b,a,ah,al); */
  15.     b=b>>1;
  16. }
  17. i=1;
  18.  while(b)
  19.    {if (b & 1)
  20.       {lshift(a,i,temph,templ);
  21.        ladd(temph,templ,ah,al);}
  22.      i++;b=b>>1;
  23.      }
  24.  ladd(0,c,ah,al);
  25.   KCLNORMALIZE(ah,al);
  26.    *h=ah;*l=al;
  27. }
  28.  
  29. #ifndef VSSIZE
  30. try(h,d, h1,l1, qp, rp)
  31. unsigned int d, h, h1,l1,*qp, *rp;
  32. {
  33. extended_mul (h,d,h1,qp,rp);
  34. }
  35. #endif
  36.  
  37.     
  38.  
  39.